package com.hzncc.scaffold.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.hzncc.scaffold.entity.Other.Question;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzncc.scaffold.entity.Vo.ListQuestionVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 问题表 Mapper 接口
 * </p>
 *
 * @author DrunkBear
 * @since 2022-04-27
 */
public interface QuestionMapper extends BaseMapper<Question> {

    @Select("SELECT\n" +
            "\tquestion.answer,\n" +
            "\tquestion.id,\n" +
            "\tquestion.title,\n" +
            "\tquestion.`option`,\n" +
            "\tquestion.type,\n" +
            "\tquestion.analyse \n" +
            "FROM\n" +
            "\t`question` ${ew.customSqlSegment}")
    public List<ListQuestionVo> listQuestion(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);


    @Select("SELECT\n" +
            "\tCOUNT(question.id)\n" +
            "FROM\n" +
            "\t`question` ${ew.customSqlSegment}")
    public Integer statisticsQuestion(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);

}
